#!/bin/bash
export BUILD_ID=dontkillme

echo "ver: $BUILD_NUMBER" >> src/main/webapp/a.html

mvn package

kill $(ps aux | grep tomcat8 | grep -v grep | awk '{print $2}')

while true; do
have=$(netstat -anp | grep 80 -w | grep -v grep)
if [ -n "$have" ]; then
  sleep 5
else
  break
fi
done


rm /opt/tomcat8/webapps/ROOT* -rf 

cp target/virstu.war /opt/tomcat8/webapps/ROOT.war

/opt/tomcat8/bin/startup.sh


